# -*- coding: utf-8 -*-
'''
Credit to 长安1206@欢乐窝
'''

import git
import os
import datetime, pytz

# Get current time
def get_current_time():
    tz_shanghai = pytz.timezone('Asia/Shanghai')
    now = datetime.datetime.now(tz = tz_shanghai)
    current_time = now.strftime("%Y-%m-%d-%Hh%M")
    return current_time

# 
def upload_git():
    current_dir = os.path.dirname(__file__)
    repo = git.Repo(current_dir)

    repo.git.add('-A')
    repo.git.commit('-m', 'Upload '+ get_current_time())
    remote = repo.remote()
    remote.push()


if __name__ == '__main__':
    upload_git()